<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
// Cookie들을 조회해서 그 이름이 "id"인 것을 찾아서
// 그 값을 "login_id" input 태그의 값으로 지정
Cookie[] cookies = request.getCookies();
String rememberedId = "";
boolean checked = false;
if (cookies != null) {
	for (int i = 0; i < cookies.length; i++) {
		if (cookies[i].getName().equals("id")) {
			rememberedId = cookies[i].getValue();
		}
		else if (cookies[i].getName().equals("rememberId")) {
			checked = cookies[i].getValue().equals("true") ? true : false;
		}
	}
}
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<form action="login2.jsp" method="post">
	ID: <input type="text" name="login_id" value="<%= rememberedId %>" />
	<input type="checkbox" name="remember_id" value="store" <%= checked ? "checked" : "" %> /> 아이디 기억<br/>
	PW: <input type="password" name="login_pw" /><br/>
	<input type="submit" value="로그인" />
</form>

</body>
</html>